package designpatterns.factory.simple;

import designpatterns.factory.product.Product;
import designpatterns.factory.product.Product1;
import designpatterns.factory.product.Product2;

/**
 * 简单工厂模式
 */
public class SimpleFactory {
    public static Product createProduct(int kind) {
        return switch (kind) {
            case 1 -> new Product1();
            case 2 -> new Product2();
            default -> null;
        };
    }
}
